package com.miyake.dsp.osa.lab.ui;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

public class ControllerPanel extends JPanel {

	
	/**
	 * 
	 */
	private static final long serialVersionUID = -6280204639461740924L;

	public ControllerPanel(final Controller controller) {
		this.setLayout(new FlowLayout());
		
		JButton saveButton = new JButton("Save");
		this.add(saveButton);
		saveButton.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				controller.onSave();
			}
			
		});
		
		JButton openButton = new JButton("Open");
		this.add(openButton);
		openButton.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				controller.onOpen();
			}
			
		});
		
		JButton clearButton = new JButton("Clear");
		this.add(clearButton);
		clearButton.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				controller.onClear();
			}
			
		});
	}
}
